package org.mnswf.model {
	import com.aol.api.wim.data.User;
	
	import mx.collections.ArrayCollection;
	
	
	public class Member {
		
		[Bindable]
		public var id:int;
		[Bindable]
		public var emailAddress:String;
		[Bindable]
		public var password:String;
		[Bindable]
		public var firstName:String;
		[Bindable]
		public var lastName:String;
		[Bindable]
		public var aimUsername:String;
		[Bindable]
		public var aimUser:User;
		[Bindable]
		public var company:String;
		[Bindable]
		public var title:String;
		[Bindable]
		public var bio:String;
		[Bindable]
		public var bioFormatted:String;
		[Bindable]
		public var isApproved:Boolean;
		[Bindable]
		public var isAdmin:Boolean;
		[Bindable]
		public var dateAdded:Date;
		[Bindable]
		public var messageCount:Number;
		[Bindable]
		public var endorsementReceivedCount:Number;
		[Bindable]
		public var endorsementGivenCount:Number;
		[Bindable]
		public var pendingEndorsementCount:Number;
		[Bindable]
		public var pendingMembers:ArrayCollection;
		[Bindable]
		public var pendingEndorsements:ArrayCollection;
		[Bindable]
		public var endorsements:ArrayCollection;
		[Bindable]
		public var certificationResults:ArrayCollection;
		
		[Bindable]
		public var sessionId:Number;
		[Bindable]
		public var sessionStartTime:Date;
		
		public function Member() {
			id = -1;
			pendingMembers = new ArrayCollection();
			pendingEndorsements = new ArrayCollection();
			endorsements = new ArrayCollection();
			certificationResults = new ArrayCollection();
		}
		
		public function parseTransferObject(transferObject:Object):void {
			id = (transferObject.ID != null) ? transferObject.ID : transferObject.id;
			emailAddress = (transferObject.EMAILADDRESS != null) ? transferObject.EMAILADDRESS : transferObject.emailAddress;
			firstName = (transferObject.FIRSTNAME != null) ? transferObject.FIRSTNAME : transferObject.firstName;
			lastName = (transferObject.LASTNAME != null) ? transferObject.LASTNAME : transferObject.lastName;
			aimUsername = (transferObject.AIMUSERNAME != null) ? transferObject.AIMUSERNAME : transferObject.aimUsername;
			company = (transferObject.COMPANY != null) ? transferObject.COMPANY : transferObject.company;
			title = (transferObject.TITLE != null) ? transferObject.TITLE : transferObject.title;
			bio = (transferObject.BIO != null) ? transferObject.BIO : transferObject.bio;
			bioFormatted = (transferObject.BIOFORMATTED != null) ? transferObject.BIOFORMATTED : transferObject.bioFormatted;
			isApproved = (transferObject.ISAPPROVED != null) ? transferObject.ISAPPROVED : transferObject.isApproved;
			isAdmin = (transferObject.ISADMIN != null) ? transferObject.ISADMIN : transferObject.isAdmin;
			dateAdded = (transferObject.DATEADDED != null) ? transferObject.DATEADDED : transferObject.dateAdded;
			messageCount = (transferObject.MESSAGECOUNT != null) ? transferObject.MESSAGECOUNT : transferObject.messageCount;
			endorsementReceivedCount = (transferObject.ENDORSEMENTRECEIVEDCOUNT != null) ? transferObject.ENDORSEMENTRECEIVEDCOUNT : transferObject.endorsementReceivedCount;
			endorsementGivenCount = (transferObject.ENDORSEMENTGIVENCOUNT != null) ? transferObject.ENDORSEMENTGIVENCOUNT : transferObject.endorsementGivenCount;
			pendingEndorsementCount = (transferObject.PENDINGENDORSEMENTCOUNT != null) ? transferObject.PENDINGENDORSEMENTCOUNT : transferObject.pendingEndorsementCount;
			sessionId = (transferObject.SESSIONID != null) ? transferObject.SESSIONID : transferObject.sessionId;
			sessionStartTime = (transferObject.SESSIONSTARTTIME != null) ? transferObject.SESSIONSTARTTIME : transferObject.sessionStartTime;
		}
		
	}
	
}